<?php
/* @var $this UserController */
/* @var $model User */
/* @var $form CActiveForm */
$baseUrl = Yii::app()->baseUrl;
$cs = Yii::app()->getClientScript();
Yii::app()->clientScript->registerCoreScript('jquery');
$cs->registerCssFile($baseUrl.'/css/form.css');


?>

<div class="form">
<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'user-form',
	'enableAjaxValidation'=>false,
)); ?>

	<p class="note">Fields with <span class="required">*</span> are required.</p>

    <?php if($model->isNewRecord):?>
	<?php echo $form->errorSummary($model); ?>
    <?php endif;?>
    <table class="table">
        <tbody>
            <tr>
                <td>
                    <?php echo $form->labelEx($model,'user_name'); ?>
                </td>
                <td>
		            <?php echo $form->textField($model,'user_name',array('size'=>20,'maxlength'=>20)); ?>
		            <?php echo $form->error($model,'user_name'); ?>
                </td>
            </tr>
            <tr>
                <td>
                    <?php echo $form->labelEx($model,'password'); ?>
                </td>
                <td>
                    <?php echo $form->textField($model,'password',array('size'=>20,'maxlength'=>20)); ?>
		            <?php echo $form->error($model,'password'); ?>
                </td>
            </tr>
            <tr>
                <td>
                    <?php echo $form->labelEx($model,'nick_name'); ?>
                </td>
                <td>
                    <?php echo $form->textField($model,'nick_name',array('size'=>20,'maxlength'=>20)); ?>
		            <?php echo $form->error($model,'nick_name'); ?>
                </td>
            </tr>
 
            <tr>
                <td>
                    <?php echo $form->labelEx($model,'tel'); ?>
                </td>
                <td>
		            <?php echo $form->textField($model,'tel',array('size'=>20,'maxlength'=>20)); ?>
		            <?php echo $form->error($model,'tel'); ?>
                </td>
            </tr>
 
            <tr>
                <td>
                    <?php echo $form->labelEx($model,'email_address'); ?>
                </td>
                <td>
		            <?php echo $form->textField($model,'email_address',array('size'=>30,'maxlength'=>80)); ?>
		            <?php echo $form->error($model,'email_address'); ?>
                </td>
            </tr>
 
            <tr>
                <td>
                    <?php echo $form->labelEx($model,'job_number'); ?>
                </td>
                <td>
		            <?php echo $form->textField($model,'job_number',array('size'=>20,'maxlength'=>20)); ?>
		            <?php echo $form->error($model,'job_number'); ?>
                </td>
            </tr>
            <tr>
                <td>
                    <?php echo $form->labelEx($model,'school_name'); ?>
                </td>
                <td>
		            <?php echo $form->textField($model,'school_name',array('size'=>30,'maxlength'=>80)); ?>
		            <?php echo $form->error($model,'school_name'); ?>
                </td>
            </tr>

            <tr>
                <td>
                    <?php echo $form->labelEx($model,'college'); ?>
                </td>
                <td>
		            <?php echo $form->textField($model,'college',array('size'=>30,'maxlength'=>80)); ?>
		            <?php echo $form->error($model,'college'); ?>
                </td>
            </tr>
            <?php if(yii::app()->user->checkAccess('root')):?>
            <tr>
                <td>
                    <?php echo "<label>用户角色：</label>"; ?>
                </td>
                <td>
		            <?php echo $form->dropDownList($model,'role',array('1'=>'普通用户','2'=>'系统管理员')); ?>
                </td>
            </tr>
            <?php endif;?>
        </tbody>
    </table>

    <?php /* The following code snippet is used to generate the verification code */ ?>
	<?php /* @author : xgqin <xgqin@guet.edu.cn> */ ?>
	<?php /* @date : 02/02/2013 */ ?>
	<?php if(CCaptcha::checkRequirements()): ?>
	<div class="form-group">
		<?php echo $form->labelEx($model,'verifyCode'); ?>
		<div>
		<?php $this->widget('CCaptcha'); ?>
		<?php echo $form->textField($model,'verifyCode', array('size'=>10,'maxlength'=>80)); ?>
		</div>
		<?php echo $form->error($model,'verifyCode'); ?>
	</div>
	<?php endif; ?>


	<div class="form-group buttons">
        <?php echo CHtml::submitButton($model->isNewRecord ? yii::t('models/User','Register') : 'Save', array('class' => 'btn btn-success')); ?>
	</div>

<?php $this->endWidget(); ?>

</div><!-- form -->

